﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace HDJ.Framework.Core
{
    class TableTypeSupprotVector3 : TableTypeSupportBase
    {
        public override List<string> TypeStringSupport => new List<string>() { "Vector3" };

        public override Type TableType => typeof(Vector3);

        protected override string Object2String(object value)
        {
            return base.Object2String(value);
        }
        protected override object String2Object(string data)
        {
            data = data.Replace("(", "");
            data = data.Replace(")", "");
            string[] temp = data.Split(new char[] { ',' });
            float[] temp1 = new float[temp.Length];
            for (int i = 0; i < temp.Length; i++)
            {
                temp1[i] = float.Parse(temp[i]);
            }
            Vector3 v3 = new Vector3(temp1[0], temp1[1], temp1[2]);
            return v3;
        }
        public override object GetTypeDefultValue()
        {
            return Vector3.zero;
        }
    }
}
